package org.example.zrccddllljh.Service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.example.zrccddllljh.Mapper.NurseMapper;
import org.example.zrccddllljh.Pojo.Doctor;
import org.example.zrccddllljh.Pojo.Nurse;
import org.example.zrccddllljh.Service.NurseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class NurseServiceImpl implements NurseService {
    @Autowired
    private NurseMapper nurseMapper;
    @Override
    public List<Nurse> list() {

        return   nurseMapper.list();
    }

    @Override
    public void add(Nurse nurse) {
        nurse.setUpdateTime(LocalDateTime.now());
        nurse.setCreateTime(LocalDateTime.now());
        nurseMapper.add(nurse);
    }

    @Override
    public void updata( Nurse nurse) {

        nurse.setUpdateTime(LocalDateTime.now());
        nurseMapper.updata(nurse);
    }

    @Override
    public void deleteById(Integer id) {
        nurseMapper.deleteById(id);
    }

    @Override
    public List<Nurse> aaa(int pageNow, int pageSize) {
        PageHelper.startPage(pageNow,pageSize);
        List<Nurse> orderInfoList = nurseMapper.getOrderInfoList();
        PageInfo<Nurse> userPageInfo = new PageInfo<>(orderInfoList);
        return userPageInfo.getList();
    }
}
